/*****************************************************************************
 *
 *                      HUSONG PROPRIETARY INFORMATION
 *
 *          The information contained herein is proprietary to HUSONG
 *           and shall not be reproduced or disclosed in whole or in part
 *                    or used for any design or manufacture
 *              without direct written authorization from HUSONG.
 *
 *            Copyright (c) 2015 by HUSONG.  All rights reserved.
 *
 *****************************************************************************/
package com.broker.consumer.controller;

import java.util.Map;

import me.send.broker.entity.base.ReturnJsonBean;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.broker.consumer.controller.base.BaseController;

/**
 * @author maxmin
 *
 * @date 2015年8月27日 上午9:40:48
 */
@Controller
@RequestMapping(value = "/opencity")
public class OpenCityController extends BaseController {

	/**
	 * 获取城市列表
	 * 
	 * @param devicenumber
	 * @return
	 * @author maxmin
	 * @date 2015年8月27日上午10:15:17
	 */
	@RequestMapping(value = "list/all")
	@ResponseBody
	public Map<String, Object> list_all(String devicenumber) {
		return openCityService.list_all(devicenumber);
	}
	
	/**
	 * 根据传过来的经度纬度 获取城市的名称
	 * 
	 */
	@RequestMapping(value="location/cityname")
	@ResponseBody
	public Map<String, Object> location_cityname(String devicenumber,String x,String y) {
		return openCityService.location_cityname(devicenumber, x, y);
	}

	/**
	 * 安卓端获取城市列表
	 * 
	 * @param devicenumber
	 * @return
	 */
	@RequestMapping(value = "cities")
	@ResponseBody
	public ReturnJsonBean citiesForAdnroid(String devicenumber) {
		ReturnJsonBean rb = new ReturnJsonBean();
		try {
			Map<String, Object> map = openCityService
					.citiesForAndroid(devicenumber);
			rb.setDatas(map);
			rb.setCode(ReturnJsonBean.SUCCESS);
			rb.setMessage(ReturnJsonBean.SUCCESS_STR);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return rb;
	}
}
